﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace fcwms.BLL
{
    /// <summary>
    /// dt_location
    /// </summary>
    public partial class dt_location
    {
        private readonly fcwms.DAL.dt_location dal = new fcwms.DAL.dt_location();
        public dt_location()
        { }
        #region  BasicMethod
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int id)
        {
            return dal.Exists(id);
        }

         /// <summary>
        /// 是否存在库位
        /// </summary>
        public bool Exists(string position)
        {
            return dal.Exists(position);
        }

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(fcwms.Model.dt_location model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(fcwms.Model.dt_location model)
        {
            return dal.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int id)
        {

            return dal.Delete(id);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool DeleteList(string idlist)
        {
            return dal.DeleteList(idlist);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public fcwms.Model.dt_location GetModel(int id)
        {

            return dal.GetModel(id);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public fcwms.Model.dt_location GetModel2(string decla_id, string storage_id, string shelf_id)
        {

            return dal.GetModel2(decla_id,storage_id,shelf_id);
        }



        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetLocation(string strWhere)
        {
            return dal.GetLocation(strWhere);
        }
       
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<fcwms.Model.dt_location> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<fcwms.Model.dt_location> DataTableToList(DataTable dt)
        {
            List<fcwms.Model.dt_location> modelList = new List<fcwms.Model.dt_location>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                fcwms.Model.dt_location model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

       

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}
